<?php
if(isset($_POST["submit"]) == '')
{
?>
<div id="content_wrapper">
<div id="main_content" class="cf">
<form action="" class="formEl" id="form_a" method="post" enctype="multipart/form-data">
<div class="cf sepH_c">
<div id="content_actions" class="fr">
<button class="fr next btn btn_d submitForm" name="submit" type="submit" value="Submit">Thêm mới</button>
<a href="javascript:void(0)" class="clear_form btn btn_a">Clear form</a>
<a href="javascript:history.go(-1)" class="btn btn_a">Cancel</a></div>

</div>



<div class="msg_box msg_error" id="form_a_errors" style="display: none"></div>

<div class="content_panes">

<div id="tab-1">

<div class="formEl_a">

<fieldset><legend>Thêm <?php
if ($_GET["cat_id"] == 1) echo "tin tức";
elseif ($_GET["cat_id"] == 2) echo "tuyển dụng";
else echo "tin bosch";
?> mới</legend>
<div class="sepH_b"><label for="title" class="lbl_a">Tên</label> 
	<input type="text" id="title" name="title" class="inpt_a" />
</div>

<div class="sepH_c cf"><label for="description" class="lbl_a">Tóm tắt nội dung</label> 
	<textarea name="description" id="description"  class="txtar_a" cols="30" rows="10" ></textarea>
</div>

<div class="sepH_b"><label for="images" class="lbl_a">Ảnh bài viết</label> 
	<input type="file" id="images" name="images" class="inpt_a" />
</div>

<div class="sepH_c cf"><label for="text" class="lbl_a">Chi tiết tin</label>
	<textarea name="content" id="content" cols="50" rows="10" class="tinymce txtar_a"></textarea>
</div>

</fieldset>

</div>
</div>


</div>
</form>
</div>
</div>
<?php
} else {
	$news->settitle($_POST["title"]);
	$news->setdescription($_POST["description"]);
	$news->setcontent($_POST["content"]);
//	$news->setimage();
//	$news->setimage2();
//	$news->setimage3($image3);
//	$news->setstatus($_POST["status"]);
//	$news->setbanchay($_POST["banchay"]);
	$news->setimage($main->upimg($_FILES["images"], "../uploads/news/"));
	$news->seturl_rewrite($main->url_friend($_POST["title"]));
	$news->setcat_id($_GET["cat_id"]);
	//echo $main->url_friend($_POST["name"]);
	$msg = $news->insert();
	$main->redirect("index.php?m=".$_GET["m"]."&cat_id=".$_GET["cat_id"]);
}
?>
<link rel="stylesheet" href="lib/elfinder/css/elfinder.full.css"
	type="text/css" />
<link rel="stylesheet" href="lib/fancybox/jquery.fancybox-1.3.4.css"
	type="text/css" />
<link rel="stylesheet" href="lib/file-uploader/fileuploader.css"
	type="text/css" />

<script type="text/javascript">
		head.js(
			"js/jquery-1.6.2.min.js",
			"lib/jquery-ui/jquery-ui-1.8.15.custom.min.js",
			"lib/harvesthq-chosen/chosen.jquery.min.js",
			"lib/fusion-charts/FusionCharts.js",
			"lib/fancybox/jquery.easing-1.3.pack.js",
			"lib/fancybox/jquery.fancybox-1.3.4.pack.js",
			"lib/tiny-mce/jquery.tinymce.js",
			"js/jquery.microaccordion.js",
			"js/jquery.tools.min.js",
			"js/jquery.stickyPanel.js",
			"js/xbreadcrumbs.js",
			"lib/jquery-validation/jquery.validate.js",
			"js/lagu.js",
			function(){
				lga_fusionCharts.chart_k();
				lga_flowTabs.tabs_b();
				lga_selectBox.init();
				lga_datepicker.init();
				lga_editor.init();
				lga_sticky.sticky_contentActions();
				lga_clearForm.init();			
				lga_form_a_validation.init();
			}
		)
    </script>
